package com.keepers.repair.webservice

import com.keepers.repair.model.XmlRootModel
import io.reactivex.Observable
import retrofit2.adapter.rxjava2.Result
import retrofit2.http.GET
import retrofit2.http.Query

interface UserService {

    /**
     * 用户登录
     *
     * @param username 用户名
     * @param password 密码
     */
    @GET(value = "GetLogin")
    fun login(
            @Query(value = "userName") username: String,
            @Query(value = "passWord") password: String
    ): Observable<Result<XmlRootModel>>

    /**
     * 用户退出
     *
     * @param userId 用户 ID
     */
    @GET(value = "ExitLogin")
    fun logout(
            @Query(value = "UserId") userId: String
    ): Observable<Result<XmlRootModel>>

    /**
     * 修改密码
     *
     * @param userGid  用户 ID
     * @param password 新的密码
     */
    @GET(value = "SetPassWord")
    fun setPassword(
            @Query(value = "UserGid") userGid: String,
            @Query(value = "password") password: String
    ): Observable<Result<XmlRootModel>>

    /**
     * 获取通知列表
     *
     * @param groupGid 用户组 ID
     * @param userGid  用户 ID
     */
    @GET(value = "GetNoticeListByID")
    fun getNoticeList(
            @Query(value = "GroupGid") groupGid: String,
            @Query(value = "UserGid") userGid: String
    ): Observable<Result<XmlRootModel>>

    /**
     * 获取用户任务列表
     * @param groupGid 用户组 ID
     * @param userGid  用户 ID
     */
    @GET(value = "GetRepairTaskList")
    fun getTaskList(
            @Query(value = "GroupGid") groupGid: String,
            @Query(value = "UserId") userGid: String
    ): Observable<Result<XmlRootModel>>

    /**
     * 获取维修单列表
     * @param groupGid 用户组 ID
     * @param userId   用户 ID
     */
    @GET(value = "GetRepairList")
    fun getRepairList(
        @Query(value = "UserID") userId: String,
        @Query(value = "GroupGid") groupGid: String
    ): Observable<Result<XmlRootModel>>
}
